//
//  LogisticsDetail.swift
//
//  Created by 邱仙凯 on 2021/6/10
//  Copyright (c) . All rights reserved.
//

import Foundation
import ObjectMapper

public struct ZyaLogisticsDetail: Mappable {
    
    // MARK: Declaration for string constants to be used to decode and also serialize.
    private struct SerializationKeys {
        static let zAmountHt = "z_amount_ht"
        static let zVouId = "z_vou_id"
        static let zSpec = "z_spec"
        static let idKey = "id_key"
        static let zValidDate = "z_valid_date"
        static let zPictureUrl = "z_picture_url"
        static let zUniqueCode = "z_unique_code"
        static let zAmountFh = "z_amount_fh"
        static let zGoodsId = "z_goods_id"
        static let zGoodsNm = "z_goods_nm"
        static let ztbFileUrl = "ztb_file_url"
        static let zVender = "z_vender"
        static let zUnit = "z_unit"
        static let zSendAmount = "z_send_amount"
        static let zProduceDate = "z_produce_date"
    }
    
    // MARK: Properties
    public var zAmountHt: Int?
    public var zVouId: Int?
    public var zSpec: String?
    public var idKey: Int?
    public var zValidDate: String?
    public var zPictureUrl: String?
    public var zUniqueCode: String?
    public var zAmountFh: String?
    public var zGoodsId: Int?
    public var zGoodsNm: String?
    public var ztbFileUrl: String?
    public var image: UIImage?
    public var zVender: String?
    public var zUnit: String?
    public var zSendAmount: String?
    public var zProduceDate: String?

    
    var fromContract = false
    // MARK: ObjectMapper Initializers
    /// Map a JSON object to this class using ObjectMapper.
    ///
    /// - parameter map: A mapping from ObjectMapper.
    public init?(map: Map){
        
    }
    
    /// Map a JSON object to this class using ObjectMapper.
    ///
    /// - parameter map: A mapping from ObjectMapper.
    public mutating func mapping(map: Map) {
        zAmountHt <- map[SerializationKeys.zAmountHt]
        zVouId <- map[SerializationKeys.zVouId]
        zSpec <- map[SerializationKeys.zSpec]
        idKey <- map[SerializationKeys.idKey]
        zValidDate <- map[SerializationKeys.zValidDate]
        zPictureUrl <- map[SerializationKeys.zPictureUrl]
        zUniqueCode <- map[SerializationKeys.zUniqueCode]
        zAmountFh <- (map[SerializationKeys.zAmountFh], StringTransform())
        zGoodsId <- map[SerializationKeys.zGoodsId]
        zGoodsNm <- map[SerializationKeys.zGoodsNm]
        ztbFileUrl <- map[SerializationKeys.ztbFileUrl]
        zVender <- map[SerializationKeys.zVender]
        zSendAmount <- (map[SerializationKeys.zSendAmount], StringTransform())
        zUnit <- map[SerializationKeys.zUnit]
        zProduceDate <- map[SerializationKeys.zProduceDate]

        
    }
    
    /// Generates description of the object in the form of a NSDictionary.
    ///
    /// - returns: A Key value pair containing all valid values in the object.
    public func dictionaryRepresentation() -> [String: Any] {
        var dictionary: [String: Any] = [:]
        if let value = zAmountHt { dictionary[SerializationKeys.zAmountHt] = value }
        if let value = zVouId { dictionary[SerializationKeys.zVouId] = value } else {
            dictionary[SerializationKeys.zVouId] = ""
        }
        if let value = zSpec { dictionary[SerializationKeys.zSpec] = value }
        if let value = idKey { dictionary[SerializationKeys.idKey] = value } else {
            dictionary[SerializationKeys.idKey] = ""
        }
        if let value = zValidDate { dictionary[SerializationKeys.zValidDate] = value }
        if let value = zPictureUrl { dictionary[SerializationKeys.zPictureUrl] = value }
        if let value = zUniqueCode { dictionary[SerializationKeys.zUniqueCode] = value }
        if let value = zAmountFh { dictionary[SerializationKeys.zAmountFh] = value }
        if let value = zGoodsId { dictionary[SerializationKeys.zGoodsId] = value }
        if let value = zGoodsNm { dictionary[SerializationKeys.zGoodsNm] = value }
        if let value = ztbFileUrl { dictionary[SerializationKeys.ztbFileUrl] = value }
        if let value = zVender { dictionary[SerializationKeys.zVender] = value }
        if let value = zUnit { dictionary[SerializationKeys.zUnit] = value }
        if let value = zSendAmount { dictionary[SerializationKeys.zSendAmount] = value }
        if let value = zProduceDate { dictionary[SerializationKeys.zProduceDate] = value }

        
        return dictionary
    }
    
}
